extends Polygon2D

var FADE_ANITIME = 1

class_name Fader


func fade_out():
	visible = true
	var tween =  SDTween.new(self,"become_invisible")
	add_child(tween)
	tween.interpolate_property(self,"modulate",Color(1,1,1,1),Color(1,1,1,0),FADE_ANITIME,Tween.TRANS_CUBIC,Tween.EASE_IN_OUT)
	tween.start()

func fade_in():
	modulate = ColorN("white",0)
	visible = true
	var tween =  SDTween.new()
	add_child(tween)
	tween.interpolate_property(self,"modulate",Color(1,1,1,0),Color(1,1,1,1),FADE_ANITIME,Tween.TRANS_CUBIC,Tween.EASE_IN_OUT)
	tween.start()

func become_invisible():
	visible = false
	modulate = ColorN("white")
